<!--master-->
<table>
	<caption>
		<label for="recordType"><g:message code="b2b.salesOrder.recordType" default="Record Type" /></label>:
		${salesOrderInstance?.recordType?.encodeAsHTML()}
		<g:hiddenField name="recordType.id" value="${salesOrderInstance?.recordType?.id}" />
	</caption>
    <tbody>
        <tr class="prop">
        	<!-- dealer -->
            <td class="name">
                <label for="dealer"><g:message code="b2b.salesOrder.dealer" default="Dealer" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'dealer', 'errors')}">
                <g:textField name="dealerInput" value="${salesOrderInstance?.dealer?.encodeAsHTML()}"/>
                <g:hiddenField name="dealer.id" value="${salesOrderInstance?.dealer?.id}" />
            </td>
            <!-- department-->
            <td class="name">
                <label for="department"><g:message code="b2b.salesOrder.department" default="Department" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'department', 'errors')}">
                <span id="department">
                    ${include(controller : 'salesOrderAjax', action : 'getDealerDepartment', params : [dealerSerialNumber : salesOrderInstance?.dealer?.serialNumber] )}
                </span>
            </td>
            <!--orderdate -->
            <td class="name">
                <label for="orderDate"><g:message code="b2b.salesOrder.orderDate" default="Order Date" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'orderDate', 'errors')}">
            	<g:set var="orderDate" value="${salesOrderInstance.orderDate?salesOrderInstance.orderDate:new Date() }"></g:set>
                ${formatDate(format:'yyyy-MM-dd', date : orderDate) }
                <g:hiddenField name="orderDate_year" value="${formatDate(format:'yyyy', date : orderDate) }" />
                <g:hiddenField name="orderDate_month" value="${formatDate(format:'MM', date : orderDate) }" />
                <g:hiddenField name="orderDate_day" value="${formatDate(format:'dd', date : orderDate) }" />
            </td>
		</tr>  
		
		<tr class="prop">
            <!-- industry -->
            <td class="name">
            	<label for="industry"><g:message code="b2b.salesOrder.industry" default="Industry" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'industry', 'errors')}">
                <g:textField name="industryInput" value="${salesOrderInstance?.industry?.encodeAsHTML()}" />
                <g:hiddenField name="industry.id" value="${salesOrderInstance?.industry?.id}"  />
			</td>
        	<!-- project -->
            <td class="name">
				<label for="project"><g:message code="b2b.salesOrder.project" default="Project" /></label>
			</td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'project', 'errors')}">
				<g:textField name="project" value="${salesOrderInstance?.project }"/>
			</td>
        	<!-- account serial number -->
            <td class="name">
				<label for="accountSerialNumber"><g:message code="b2b.salesOrder.accountSerialNumber" default="Account Order Number" /></label>
			</td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'accountSerialNumber', 'errors')}">
				<g:textField name="accountSerialNumber" value="${salesOrderInstance?.accountSerialNumber }"/>
			</td>
		</tr>
		
		<tr class="prop">
			<!-- 4.1 -->
            <td class="name">
                <label for="salesMan"><g:message code="b2b.salesOrder.salesMan" default="Sales Man" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesMan', 'errors')}">
                <span id="salesMan">${salesOrderInstance?.salesMan?.encodeAsHTML()}</span>
                <g:hiddenField name="salesMan.id" value="${salesOrderInstance?.salesMan?.id}" />
            </td>
        	<td class="name">&nbsp;</td>
        	<td class="value">&nbsp;</td>
        	<td class="name">&nbsp;</td>
        	<td class="value">&nbsp;</td>
		</tr>

        <tr class="prop">
            <td class="name">
                <label for="address1"><g:message code="b2b.salesOrder.address1" default="Address(1)" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'address1', 'errors')}" colspan="5">
                <g:textArea name="address1" maxlength="72" value="${salesOrderInstance?.address1}" />
            </td>
        </tr> 

        <tr class="prop">
            <td class="name">
                <label for="address2"><g:message code="b2b.salesOrder.address2" default="Address(2)" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'address2', 'errors')}" colspan="5">
                <g:textArea name="address2" maxlength="72" value="${salesOrderInstance?.address2}" />
            </td>
        </tr>        
		
        <tr class="prop">
        	<!-- 5 -->
            <td class="name">
                <label for=""><g:message code="b2b.salesOrder.description" default="Desc" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: '', 'errors')}" colspan="5">
                <g:textArea name="description" cols="40" rows="5" value="${salesOrderInstance?.description}" />
            </td>
        </tr>		
		   
	</tbody>
</table>
<!--end master-->
<!--detail-->
<table>
    <tbody id="salesOrderDetailFooter">
    	<tr>
    		<td>
    			<label for="searchProductNumber"><g:message code="b2b.salesOrderDetail.search.product" default="Search Product" />:</label>
		        <g:textField name="searchProductNumber" style="width:300px;"/>
		        <g:hiddenField name="searchProductId"/>
		        <span id="searchProductName"></span>
		        ,<span id="searchProductStandard"></span>
		        ,<span id="searchProductPrice"></span>
			</td>
    	</tr>
    </tbody>
</table>
<table>
    <thead>
        <tr>
            <th><g:message code="b2b.salesOrderDetail.serialNumber" default="Serial Number" /></th>
            <th><g:message code="b2b.salesOrderDetail.openDetail" default="Open Detail" /></th>
            <th><g:message code="b2b.salesOrderDetail.product" default="Product" /></th>
            <th><g:message code="b2b.product.name" default="Product Name" /></th>
            <th><g:message code="b2b.product.standard" default="Standard" /></th>
            <th><g:message code="b2b.product.category" default="Category" /></th>
            <th>
                <g:message code="b2b.salesOrderDetail.price" default="Price" />
                (<g:message code="b2b.category.isAllowZeroPrice" default="Allow Zero Price?" />)
            </th>
            <th><g:message code="b2b.salesOrderDetail.discount" default="Discount" /></th>
            <th>
                <g:message code="b2b.salesOrderDetail.quantity" default="Order Quantity" />
                (<g:message code="b2b.bomDetail.dosage" default="Dosage" />,
                <g:message code="b2b.bomDetail.quota" default="Quota" />)
            </th>
            <th>
                <g:message code="b2b.salesOrderDetail.deliveryLimitation" default="Delivery Limitation" />
                (<g:message code="b2b.category.deliveryCycle" default="Delivery Cycle" />)
            </th>
            <th><g:message code="b2b.salesOrderDetail.amount" default="Amount" /></th>
            <th><g:message code="b2b.salesOrderDetail.contractDetail" default="Contract Detail" /></th>
            <th>
                <g:message code="b2b.salesOrderDetail.specialDiscount" default="Special Discount" />
                (<g:message code="b2b.category.isAllowSpecialDiscount" default="Allow Special Discount?" />)
            </th>
            <th><g:message code="b2b.salesOrderDetail.specialAmount" default="Special Amount" /></th>
            <th><g:message code="b2b.salesOrderDetail.finalDiscount" default="Final Discount" /></th>
            <th><g:message code="b2b.salesOrderDetail.finalAmount" default="Final Amount" /></th>
        </tr>
    </thead>
    <tbody id="salesOrderDetailList">
	<!--define total amount-->
    <g:set var="_total_amount" value="${0}"/>
	<!--define total special amount-->
    <g:set var="_total_special_amount" value="${0}" />
	<!--define total final amount-->
    <g:set var="_total_final_amount" value="${0}" />
	<!--begin salesOrderDetail each-->
    <g:each in="${salesOrderInstance?.salesOrderDetails}" status="i" var="salesOrderDetailInstance">
		<!--calc row category-->
		<g:set 
            var="category" 
            value="${include(controller : 'salesOrderAjax', action : 'productCategoryOfCG', params : [product : salesOrderDetailInstance?.product?.serialNumber] )}" />
		<!-- calc rowspan -->
		<g:set var="rowspan" value="${0}" />
		<g:if test="${salesOrderDetailInstance?.salesOrderDetailDetails?.size() > 0}">
		    <g:set var="rowspan" value="${salesOrderDetailInstance?.salesOrderDetailDetails?.size() + 1}" />
		</g:if>
		<!--calc row amount-->
		<g:set var="_amount"
			value="${(salesOrderDetailInstance?.amount)?:((salesOrderDetailInstance?.price ?:0) * (salesOrderDetailInstance?.discount ?: 0) * (salesOrderDetailInstance?.quantity ?: 0))}" />       	
		<!-- row special amount -->
		<g:set var="_special_amount" 
			value="${(salesOrderDetailInstance?.specialAmount)?:((salesOrderDetailInstance?.price ?: 0) * (salesOrderDetailInstance?.discount ?: 0) * (salesOrderDetailInstance?.specialDiscount ?: 0) * (salesOrderDetailInstance?.quantity ?: 0))}" />       	
		<!-- row final amount -->
		<g:set var="_final_amount" 
			value="${(salesOrderDetailInstance?.finalAmount)?:((salesOrderDetailInstance?.price ?: 0) * (salesOrderDetailInstance?.discount ?: 0) * (1 - (salesOrderDetailInstance?.specialDiscount ?: 0)) * (salesOrderDetailInstance?.quantity ?: 0))}" />       	
		<!-- total amount plus -->
		<g:set var="_total_amount" value="${(_total_amount ?: 0) + (_amount ?: 0)}"></g:set>
		<!-- total special amount plus -->
		<g:set var="_total_special_amount" value="${(_total_special_amount ?: 0) + (_special_amount ?: 0)}"></g:set>
		<!-- total final amount plus -->
		<g:set var="_total_final_amount" value="${(_total_final_amount ?: 0) + (_final_amount ?: 0)}"></g:set>
		<tr class="${(i % 2) == 0 ? 'odd' : 'even'}" childs="${salesOrderDetailInstance?.serialNumber}">
			<!-- serial number -->
			<g:if test="${rowspan > 0}"><td rowspan="${rowspan}" name="serialNumber"></g:if><g:else><td name="serialNumber"></g:else>
		    	<span>${fieldValue(bean: salesOrderDetailInstance, field: "serialNumber")}</span>
		    	<g:hiddenField name="salesOrderDetails[${i}].serialNumber" value="${salesOrderDetailInstance?.serialNumber}"/>
		    	<br/>
		    	<a href="#addSalesOrderDetailLink" delete="delete">${message(code: 'default.button.delete', default: 'Delete')}</a>
		    </td>
		    <!-- open detail -->
		    <td name="openDetail">
		    	<g:checkBox name="salesOrderDetails[${i}].openDetail" value="${salesOrderDetailInstance?.openDetail}" onclick="return false;"/>
		    </td>
		    <!-- product.id -->
		    <td name="product.id">
		    	${fieldValue(bean: salesOrderDetailInstance, field: "product")}
		    	<g:hiddenField name="salesOrderDetails[${i}].product.id" value="${salesOrderDetailInstance?.product?.id}"/>
		    </td>
		    <!-- product.name -->
		    <td name="product.name">${fieldValue(bean: salesOrderDetailInstance, field: "product.name")}</td>
		    <!-- product.standard -->
		    <td name="product.standard">${fieldValue(bean: salesOrderDetailInstance, field: "product.standard")}</td>
		    <!-- category -->
		    <td name="category">
		    	${category?:""}
		    </td>
		    <!-- price -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.price', 'errors')} number" name="price">
		    	<g:textField name="salesOrderDetails[${i}].price" value="${formatNumber( number : salesOrderDetailInstance?.price, format:'###,##0.000000')}" readonly="readonly"/>
                 <span>
            		(<g:include controller="salesOrderAjax" action="isAllowZeroPrice" params="[product:salesOrderDetailInstance?.product?.serialNumber]"/>)
            	</span>
		    </td>
		    <!-- discount -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.discount', 'errors')} number" name="discount">
		    	<g:textField name="salesOrderDetails[${i}].discount" value="${formatNumber( number : salesOrderDetailInstance?.discount, format:'###,##0.0000')}" readonly="readonly"/>
		    </td>
		    <!-- quantity -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.quantity', 'errors')} number" name="quantity" >
		    	<g:textField name="salesOrderDetails[${i}].quantity" value="${formatNumber( number : salesOrderDetailInstance?.quantity, format:'###,##0.00')}"/>
		    </td>
		    <!-- delivery limitation -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.deliveryLimitation', 'errors')}" name="deliveryLimitation">
		    	<g:jqDatePicker name="salesOrderDetails[${i}].deliveryLimitation" value="${salesOrderDetailInstance?.deliveryLimitation}"/>
		    	<span>
		    		<g:include controller="salesOrderAjax" action="deliveryCycle" params="[product:salesOrderDetailInstance?.product?.serialNumber]"/>
		    	</span>
			</td>
			<!-- amount -->
		    <td class="value number" name="amount" >
		        <g:formatNumber number="${_amount}" format="###,##0.0000" />
		    </td>
		    <!-- contract detail -->
		    <td name="contractDetail.id">
		    	<span>
					<g:link controller="contract" action="show" id="${include(controller : 'salesOrderAjax', action : 'getContractId', params : [contractDetailId : salesOrderDetailInstance?.contractDetail?.id] )}">
                        <g:include 
                            controller = 'salesOrderAjax'
                            action = 'getContractDetailSerialNumber'
                            params = "[contractDetailId : salesOrderDetailInstance?.contractDetail?.id]"
                        />
					</g:link>
				</span>
		    	<g:hiddenField name="salesOrderDetails[${i}].contractDetail.id" value="${salesOrderDetailInstance?.contractDetail?.id}"/>
		    </td>
		    <!-- special discount -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.specialDiscount', 'errors')} number" name="specialDiscount">
		    	<g:textField 
					name="salesOrderDetails[${i}].specialDiscount" 
					value="${formatNumber( number : ((salesOrderDetailInstance?.openDetail == true)? 0.00 : (salesOrderDetailInstance?.specialDiscount)), format:'###,##0.0000')}" 
					readonly="readonly"/>
                <span>
            		(<g:include controller="salesOrderAjax" action="isAllowSpecialDiscount" params="[product:salesOrderDetailInstance?.product?.serialNumber]"/>)
            	</span>
		    </td>
		    <!-- special amount -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.specialAmount', 'errors')} number" name="specialAmount">
		        <g:formatNumber number="${_special_amount}" format="###,##0.0000" />
                
		    </td>
		    <!-- final discount -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.finalDiscount', 'errors')} number" name="finalDiscount">
		    	<g:textField name="salesOrderDetails[${i}].finalDiscount" value="${formatNumber( number : salesOrderDetailInstance?.finalDiscount, format:'###,##0.0000')}" readonly="readonly"/>
		    </td>
		    <!-- final amount -->
		    <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.finalAmount', 'errors')} number" name="finalAmount">
		        <g:formatNumber number="${_final_amount}" format="###,##0.0000" />
		    </td>
		</tr>
		<g:each in="${salesOrderDetailInstance?.salesOrderDetailDetails}" status="j" var="salesOrderDetailDetailInstance">
			<!-- child category -->
			<g:set 
                var="category" 
                value="${include(controller : 'salesOrderAjax', action : 'productCategoryOfCG', params : [product : salesOrderDetailDetailInstance?.product?.serialNumber] )}" />
			<g:set var="_child_amount" 
				value="${(salesOrderDetailDetailInstance?.amount)?:(salesOrderDetailDetailInstance?.price * salesOrderDetailDetailInstance?.discount * salesOrderDetailDetailInstance?.quantity)}" />       	
			<g:set var="_child_special_amount" 
				value="${(salesOrderDetailDetailInstance?.specialAmount)?:(salesOrderDetailDetailInstance?.price * salesOrderDetailDetailInstance?.discount * salesOrderDetailDetailInstance?.specialDiscount * salesOrderDetailDetailInstance?.quantity)}" />       	
			<g:set var="_child_final_amount" 
				value="${(salesOrderDetailDetailInstance?.finalAmount)?:(salesOrderDetailDetailInstance?.price * salesOrderDetailDetailInstance?.discount * (1-salesOrderDetailDetailInstance?.specialDiscount) * salesOrderDetailDetailInstance?.quantity)}" />       	

		    <tr class="${(j % 2) == 0 ? 'even' : 'old'}" parent="${salesOrderDetailInstance?.serialNumber}">
		    	<!-- serial number -->
		    	<td name="serialNumber">
		    		(+)${fieldValue(bean: salesOrderDetailDetailInstance, field: "serialNumber")}
		        	<g:hiddenField name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].serialNumber" value="${salesOrderDetailDetailInstance?.serialNumber}"/>
		    	</td>
		    	<!-- product.id -->
		        <td name="product.id">
		        	${fieldValue(bean: salesOrderDetailDetailInstance, field: "product")}
		        	<g:hiddenField name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].product.id" value="${salesOrderDetailDetailInstance?.product?.id}"/>
		        </td>
		        <!-- product.name -->
		        <td name="product.name">${fieldValue(bean: salesOrderDetailDetailInstance, field: "product.name")}</td>
		        <!-- product.standard -->
		        <td name="product.standard">${fieldValue(bean: salesOrderDetailDetailInstance, field: "product.standard")}</td>
		        <!-- category -->
		        <td name="category">${category}</td>
		        <!-- price -->
		        <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.salesOrderDetailDetails.price', 'errors')} number" name="price">
		        	<g:textField 
						name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].price" 
						value="${formatNumber( number : salesOrderDetailDetailInstance?.price, format:'###,##0.000000')}" readonly="readonly"/>
                    <span>
            		(<g:include controller="salesOrderAjax" action="isAllowZeroPrice" params="[product:salesOrderDetailDetailInstance?.product?.serialNumber]"/>)
            	    </span>
		        </td>
		        <!-- discount -->
		        <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.salesOrderDetailDetails.discount', 'errors')} number" name="discount">
		        	<g:textField 
						name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].discount" 
						value="${formatNumber( number : salesOrderDetailDetailInstance?.discount, format:'###,##0.0000')}" readonly="readonly"/>
		        </td>
		        <!-- quantity -->
		        <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.salesOrderDetailDetails.quantity', 'errors')} number" name="quantity">
		        	<g:textField 
						name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].quantity" 
						value="${formatNumber( number : salesOrderDetailDetailInstance?.quantity, format:'##0.000')}" readonly="readonly"/>
		        	<span>
		        		<g:include 
							controller="salesOrderAjax" 
							action="dosage" 
							params="[masterProduct:salesOrderDetailInstance?.product?.serialNumber,detailProduct:salesOrderDetailDetailInstance?.product?.serialNumber]"/>
		        	</span>
                    <span>,</span>
                    <span>
	            		<g:include controller="salesOrderAjax" action="quota" params="[masterProduct:salesOrderDetailInstance?.product?.serialNumber,detailProduct:salesOrderDetailDetailInstance?.product?.serialNumber]"/>
	            	</span>
		        </td>
		        <!-- blank -->
		        <td>&nbsp;</td>
		        <!-- amount -->
		        <td class="value number" name="amount">
					<g:formatNumber number="${_child_amount?:0}" format="###,##0.0000" />
		        </td>
		        <!-- contract detail -->
		        <td name="contractDetail.id">
		        	<span>
						<g:link 
                            controller="contract" 
							action="show" 
							id="${include(controller : 'salesOrderAjax', action : 'getContractId', params : [contractDetailId : salesOrderDetailDetailInstance?.contractDetail?.id] )}">
							<g:include 
                                controller = 'salesOrderAjax'
                                action = 'getContractDetailSerialNumber'
                                params = "[contractDetailId : salesOrderDetailDetailInstance?.contractDetail?.id]"
                            />
							</g:link>
						</span>
		        	<g:hiddenField name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].contractDetail.id" value="${salesOrderDetailDetailInstance?.contractDetail?.id}"/>
		        </td>
		        <!-- special discount -->
		        <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.salesOrderDetailDetails.specialDiscount', 'errors')} number" name="specialDiscount">
		        	<g:textField name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].specialDiscount" 
						value="${formatNumber( number : salesOrderDetailDetailInstance?.specialDiscount, format:'###,##0.0000')}" readonly="readonly"/>
                    <span>
            		(<g:include controller="salesOrderAjax" action="isAllowSpecialDiscount" params="[product:salesOrderDetailDetailInstance?.product?.serialNumber]"/>)
            	    </span>
		        </td>
		        <!-- special amount -->
		        <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.salesOrderDetailDetails.specialAmount', 'errors')} number" name="specialAmount">
					<g:formatNumber number="${_child_special_amount?:0}" format="###,##0.0000" />
		        </td>
		        <!-- final discount -->
		        <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.salesOrderDetailDetails.finalDiscount', 'errors')} number" name="finalDiscount">
		        	<g:textField name="salesOrderDetails[${i}].salesOrderDetailDetails[${j}].finalDiscount" 
						value="${formatNumber( number : salesOrderDetailDetailInstance?.finalDiscount, format:'###,##0.0000')}" readonly="readonly"/>
		        </td>
		        <!-- final amount -->
		        <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesOrderDetails.salesOrderDetailDetails.finalAmount', 'errors')} number" name="finalAmount">
					<g:formatNumber number="${_child_final_amount?:0}" format="###,##0.0000" />
		        </td>
		        <td>&nbsp;</td>
		    </tr>
		</g:each>
    </g:each>
    </tbody>
    <tfoot>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>
            	<label for="totalAmount"><g:message code="b2b.salesOrder.salesOrderDetails.amount.sum" default="Total Amount" /></label>
            </td>
            <td name="totalAmount">
            	<g:formatNumber number="${_total_amount?:0}" format="###,##0.0000" />
            </td>
            <td>&nbsp;</td>
            <td>
            	<label for="totalSpecialAmount"><g:message code="b2b.salesOrder.salesOrderDetails.specialAmount.sum" default="Total Special Amount" /></label>
            </td>
            <td name="totalSpecialAmount">
            	<g:formatNumber number="${_total_special_amount?:0}" format="###,##0.0000" />
            </td>
            <td>
            	<label for="totalFinalAmount"><g:message code="b2b.salesOrder.salesOrderDetails.finalAmount.sum" default="Total Final Amount" /></label>
            </td>
            <td name="totalFinalAmount">
            	<g:formatNumber number="${_total_final_amount?:0}" format="###,##0.0000" />
            </td>
        </tr>
    </tfoot>
</table>
<!--master-->
<g:render template="/b2b/salesOrder/script" />
<g:render template="/b2b/salesOrder/script_224" />
